#include "Random.h"
#include "Time.h"
#include <cmath>

using namespace SolidityEngine;

Random::Random()
{
    //ctor
}

Random::~Random()
{
    //dtor
}


float Random::Range(float lower, float upper)
{
    std::uniform_real_distribution<float> unif(lower,upper);
    return unif(_engine);
}

int Random::Range(int lower, int upper)
{
    std::uniform_int_distribution<int> unif(lower,upper);
    return unif(_engine);
}

void Random::Seed()
{
    unsigned int n = Time::CurrentTime();
    _engine.seed(n);
}

Vector2D Random::PointOnUnitCircle()
{
    float angle = Random::Range(0.0f,2.0f*pi);
    return Vector2D(cos(angle),sin(angle));

}

Vector2D Random::PointInUnitCircle()
{
    float magnitude = Random::Range(0.0f,1.0f);
    return Random::PointOnUnitCircle()*magnitude;
}

MTengine Random::_engine = MTengine();
